# 用for循环来完成简单的计数
for x in range(0, 100):
    x += 1
    print(x)


# 用while来完成简单计数
    y = 0
while y < 100:
    y += 1
    print(y)


# 用for循环来实现斐波那契函数
result_f = [0, 1]
for i in range(10):
   result_f.append(result_f[-2] + result_f[-1])
   print(result_f)


# 用while循环来实现斐波那契函数
result_w = [0]
a, b = 0, 1
while b < 100:
    result_w.append(b)
    a, b = b, a+b
    print(result_w)


# 对简单计算器进行参数检查
# 加法
def add(a, b):
    return int(a) + int(b)


# 减法
def sub(a, b):
    return int(a) - int(b)


# 乘法
def mul(a, b):
    return int(a) * int(b)


# 除法
def div(a, b):
    try:
        return int(a) / int(b)
    except ZeroDivisionError:
        raise ParamsError("分母不可以为0")



# 整除
def exa(a, b):
    try:
        return int(a) // int(b)
    except ZeroDivisionError:
        raise ParamsError("分母不可以为0")


# 取余
def rem(a, b):
    try:
        return int(a) % int(b)
    except ZeroDivisionError:
        raise ParamsError("分母不可以为0")


# 开方
def sqrt(a, b):
    return int(a) ** (1 / int(b))


if __name__ == "__main__":
    result_add = add(1, 2)
    print(result_add)


    result_sub = sub(1, 2)
    print(result_sub)


    result_mul = mul(1, 2)
    print(result_mul)

    result_div = div(1, 2)
    print(result_div)

    result_exa = exa(1, 2)
    print(result_exa)

    result_rem = rem(1, 2)
    print(result_rem)

    result_sqrt = sqrt(1, 2)
    print(result_sqrt)